const http = uni.$u.http;

const apis = {
    codeImg: '/captchaImage',
    login: '/login',
    getInfo: '/getInfo',
    logout: '/logout',
};

// 获取登录验证码
export const getCodeImg = (params = {}) => http.get(apis.codeImg, params);

// 登录
export const login = (params = {}, config = {}) => http.post(apis.login, params, config);

// 获取登录用户信息
export const getUserInfo = (params = {}) => http.get(apis.getInfo, params);

// 退出登录
export const logout = (params = {}, config = {}) => http.post(apis.logout, params, config);

// 获取经销商列表
export const listDealer2 = (params = {}) => http.get('/business/dealer/dealerList', params);

// 获取业务类型下拉列表
export const listBusiness2 = (params = {}) => http.get('/business/business/businessList', params);

// 首页列表
export const listService = (params = {}) => http.get('/business/service/list', params);

// 获取字典表
export const getDicts = (dictKey, params = {}) => http.get(`/system/dict/data/type/${dictKey}`, params);

// 上传文件
export const uploadFile = (params = {}, config = {}) => http.post('/common/upload', params, config);

// ocr识别身份证
export const ocrIdCard = (params = {}) => http.get('/business/service/ocrIdCard', params);

// ocr识别车辆信息
export const ocrCarCard = (params = {}) => http.get('/business/service/ocrCar', params);

// 识别车辆合格证
export const ocrCarQualified = (params = {}) => http.get('/business/service/ocrCarHgzInfo', params);

// 获取品牌下拉
export const listBrand2 = (params = {}) => http.get('/business/brand/brandList', params);

// 查询经销商关联的业务类型
export const listDealerBusinessType = (params = {}) => http.get('/business/dealerBusiness/dbList', params);

// 新增服务单
export const addService = (params = {}, config = {}) => http.post('/business/service', params, config);

// 修改服务单
export const updateService = (params = {}, config = {}) => http.put('/business/service', params, config);

// 查询服务单详细
export const getService = (id, params = {}) => http.get('/business/service/' + id, params);

// 服务单预览
export const orderPdfPreview = (params = {}) => http.get('/pdf/preview', params);

// 服务单下载
export const orderPdfDownload = (params = {}) => http.get('/pdf/download', params);
